var mongoose = require('mongoose');

var Schema = mongoose.Schema;

var schema = new Schema({
  accounts: String,
  logindays: {type:Number,default:0},
  lastlogintime: String,
  continuouslogintimes: {type:Number,default:0},
  maxcontinuouslogintimes: {type:Number,default:0},
  from:String,
  emailnotallow:Boolean,
  pwd: String,
  nick: String,
  avatar: { type:String,default:'default' },
  profile: { type:String,default:'nothing yet' },
  about:{type:String,default:''},
  firends: {type:Array,default:[]},
  id: Number,
  notebook:{type:Number,default:0},
  created_at:Date,
  todocount:{type:Number,default:0},
  block:{type:Number,default:0},
  disable:{type:Number,default:0},
  tocommentcount:{type:Number,default:0},
  diarycount:{type:Number,default:0},
  pageurl:{type:String,default:''}
});

schema.index({id:1},{unique:true});
schema.set('collection','users');

module.exports = mongoose.model('user',schema);
